//
//  TopicViewController.m
//  NeteaseNews
//
//  Created by liutaifeng on 16/4/13.
//  Copyright © 2016年 liutaifeng. All rights reserved.
//

#import "TopicViewController.h"
#import "LTFTopicView.h"
#import "LTFTopicContentViewController.h"
#import "IsNight.h"
@interface TopicViewController ()
<
 LTFTopicViewDelegate
>

@property (nonatomic, retain) UIView *myView;
@property (nonatomic, retain) UILabel *label;
@property (nonatomic, retain) LTFTopicView *topicView;
@end

@implementation TopicViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.navigationBar.translucent = NO;
    [self.navigationController.view addSubview:self.myView];
    
    [self createView];
}
- (void)createView {
    self.myView = [[UIView alloc] initWithFrame:CGRectMake(0, 24, self.view.frame.size.width, 40)];
    self.myView.backgroundColor = [UIColor redColor];
    [self.navigationController.view addSubview:self.myView];
    
    self.label = [[UILabel alloc] initWithFrame:CGRectMake(10, 0, 60, 40)];
    [self.myView addSubview:self.label];
    self.label.text = @"问吧";
    self.label.textColor = [UIColor whiteColor];
    [_label release];
    
    
    
    self.topicView = [[LTFTopicView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 64)];
    [self.view addSubview:_topicView];
    [_topicView release];
    _topicView.delegate = self;
}
- (void)viewWillAppear:(BOOL)animated {

    UITableView *tableView = (UITableView *)[self.view viewWithTag:1000];
    [tableView reloadData];
    [self.navigationController.view addSubview:_myView];
}
- (void)viewWillDisappear:(BOOL)animated {
    [_myView removeFromSuperview];
}


- (void)sendTopicExpertId:(NSString *)expertId {
    //self.navigationController.navigationBarHidden = YES;
    [self.myView removeFromSuperview];
    LTFTopicContentViewController *topicContentVC = [[LTFTopicContentViewController alloc] init];
    [self.navigationController pushViewController:topicContentVC animated:YES];
    topicContentVC.string = expertId;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
